package com.gnerv.sylvanas.business.manage.controller;

import com.gnerv.sylvanas.framework.common.model.RestResult;
import com.gnerv.sylvanas.business.manage.logic.CurrentAccountLogicService;
import com.gnerv.sylvanas.business.manage.model.dto.AccountDetailsDTO;
import com.gnerv.sylvanas.business.manage.model.dto.OrgTreeDTO;
import com.gnerv.sylvanas.business.manage.model.dto.ViewTreeDTO;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@CrossOrigin
@RestController
@AllArgsConstructor
@RequestMapping(value = "/api/current/account")
public class CurrentAccountController {

    private final CurrentAccountLogicService currentAccountLogicService;

    @GetMapping(value = "/details")
    public RestResult<AccountDetailsDTO> details() {
        return currentAccountLogicService.selectAccountDetails();
    }

    @GetMapping(value = "/list/view/tree")
    public RestResult<List<ViewTreeDTO>> selectListViewTree() {
        return currentAccountLogicService.selectListViewTree();
    }

    @GetMapping(value = "/list/org/tree")
    public RestResult<List<OrgTreeDTO>> selectListOrgTree() {
        return currentAccountLogicService.selectListOrgTree();
    }

}
